package exception;

import java.awt.*;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.sql.SQLException;

/**
 * 重写一个含有throws声明异常抛出的方法时,等于throws的重写规则
 */
public class ThrowsDemo {
    public void dosome()throws IOException, AWTException {

    }
}

class SubClass extends ThrowsDemo {
    //@Override//允许不在抛出任何异常
    //public void dosome() {}

    //@Override//允许抛出部分异常
    //public void dosome()throws IOException{}

    //@Override//允许抛出超类方法抛出异常的子类异常
    //public void dosome() throws FileNotFoundException {}


    //@Override//不允许抛出额外异常(超类没有抛出的且也不尊在继承关系的异常
    //public void dosome() throws SQLException {}


    //@Override//不允许抛出超类方法抛出异常的超类型异常
    //public void dosome() throws Exception{}
}
